<?php

/**
 * Created by PhpStorm.
 * User: d7
 * Date: 2015/12/30
 * Time: 9:35
 */
class MY_Web_Controller extends MY_Controller
{
    function __construct()
    {
        parent::__construct();
        @$this->load->library('session');
        $this->load->library('Auth_nuan');
        $this->_login_user = @$_SESSION['login_user'];
    }

    protected function auth($is_view=true){
        if(!$this->_login_user){
            if($is_view){
                $service = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
                $this->set_cookie('service',$service);
            }
            redirect(site_url());
        }
    }

    protected function auth_json(){
        if(!$this->_login_user){
            $this->json_response(false,'','请登录');
        }
    }
}